package org.example.jindie;

import cn.hutool.core.util.StrUtil;
import com.kingdee.bos.webapi.entity.IdentifyInfo;
import com.kingdee.bos.webapi.sdk.K3CloudApi;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;

public class Test1 {
    public static String idStr = "基本信息\n金蝶表单id\nFId\n基本信息\n金蝶表单number\nFNumber\n";

    public static void main(String[] args) throws Exception {

        String formId = "SAL_OUTSTOCK";
        String formIdCnName = "销售出库单";

        String str = idStr + "基本信息\n" +
                "物流单号\n" +
                "FLogisticsNos\n" +
                "基本信息\n" +
                "拆单新单标识\n" +
                "FDisassemblyFlag\n" +
                "基本信息\n" +
                "收货方\n" +
                "FReceiverID\n" +
                "基本信息\n" +
                "创建日期偏移单位\n" +
                "FCDateOffsetUnit\n" +
                "基本信息\n" +
                "销售部门\n" +
                "FSaleDeptID\n" +
                "基本信息\n" +
                "创建日期\n" +
                "FCreateDate\n" +
                "基本信息\n" +
                "发货组织\n" +
                "FStockOrgId\n" +
                "基本信息\n" +
                "货主类型\n" +
                "FOwnerTypeIdHead\n" +
                "基本信息\n" +
                "创建人\n" +
                "FCreatorId\n" +
                "基本信息\n" +
                "仓管员\n" +
                "FStockerID\n" +
                "基本信息\n" +
                "整单服务或费用\n" +
                "FIsTotalServiceOrCost\n" +
                "基本信息\n" +
                "销售组织\n" +
                "FSaleOrgId\n" +
                "基本信息\n" +
                "备注\n" +
                "FNote\n" +
                "基本信息\n" +
                "结算方\n" +
                "FSettleID\n" +
                "基本信息\n" +
                "客户\n" +
                "FCustomerID\n" +
                "基本信息\n" +
                "信用检查结果\n" +
                "FCreditCheckResult\n" +
                "基本信息\n" +
                "日期\n" +
                "FDate\n" +
                "基本信息\n" +
                "销售员\n" +
                "FSalesManID\n" +
                "基本信息\n" +
                "联系电话\n" +
                "FLinkPhone\n" +
                "基本信息\n" +
                "作废状态\n" +
                "FCancelStatus\n" +
                "基本信息\n" +
                "对应组织\n" +
                "FCorrespondOrgId\n" +
                "基本信息\n" +
                "销售渠道\n" +
                "FSALECHANNEL\n" +
                "基本信息\n" +
                "预设辅助资料字段2\n" +
                "FPRESETASSISTANT2\n" +
                "基本信息\n" +
                "零售单日结生成\n" +
                "FGenFromPOS_CMK\n" +
                "基本信息\n" +
                "库存组\n" +
                "FStockerGroupID\n" +
                "基本信息\n" +
                "单据状态\n" +
                "FDocumentStatus\n" +
                "基本信息\n" +
                "作废人\n" +
                "FCancellerID\n" +
                "基本信息\n" +
                "交货地点\n" +
                "FHeadLocationId\n" +
                "基本信息\n" +
                "收货方地址\n" +
                "FReceiveAddress\n" +
                "基本信息\n" +
                "管易发货日期\n" +
                "FGYDATE\n" +
                "基本信息\n" +
                "单据类型\n" +
                "FBillTypeID\n" +
                "基本信息\n" +
                "创建日期偏移量\n" +
                "FCDateOffsetValue\n" +
                "基本信息\n" +
                "序列号上传\n" +
                "FScanBox\n" +
                "基本信息\n" +
                "收货方联系人\n" +
                "FReceiverContactID\n" +
                "基本信息\n" +
                "销售组\n" +
                "FSalesGroupID\n" +
                "基本信息\n" +
                "组织间结算跨法人标识\n" +
                "FIsInterLegalPerson\n" +
                "基本信息\n" +
                "承运商\n" +
                "FCarrierID\n" +
                "基本信息\n" +
                "预设基础资料字段2\n" +
                "FPRESETBASE2\n" +
                "基本信息\n" +
                "发货部门\n" +
                "FDeliveryDeptID\n" +
                "基本信息\n" +
                "审核人\n" +
                "FApproverID\n" +
                "基本信息\n" +
                "作废日期\n" +
                "FCancelDate\n" +
                "基本信息\n" +
                "预设基础资料字段1\n" +
                "FPRESETBASE1\n" +
                "基本信息\n" +
                "运输单号\n" +
                "FCarriageNO\n" +
                "基本信息\n" +
                "交货明细执行地址(后台用)\n" +
                "FPlanRecAddress\n" +
                "基本信息\n" +
                "预设辅助资料字段1\n" +
                "FPRESETASSISTANT1\n" +
                "基本信息\n" +
                "销售门店\n" +
                "FBranchId\n" +
                "基本信息\n" +
                "付款方\n" +
                "FPayerID\n" +
                "基本信息\n" +
                "最后修改日期\n" +
                "FModifyDate\n" +
                "基本信息\n" +
                "审核日期\n" +
                "FApproveDate\n" +
                "基本信息\n" +
                "收货人姓名\n" +
                "FLinkMan\n" +
                "基本信息\n" +
                "业务类型\n" +
                "FBussinessType\n" +
                "基本信息\n" +
                "货主\n" +
                "FOwnerIdHead\n" +
                "基本信息\n" +
                "最后修改人\n" +
                "FModifierId\n" +
                "基本信息\n" +
                "网店编码\n" +
                "FSHOPNUMBER\n" +
                "基本信息\n" +
                "跨组织业务类型\n" +
                "FTransferBizType\n" +
                "基本信息\n" +
                "单据编号\n" +
                "FBillNo\n" +
                "基本信息\n" +
                "关联应收状态\n" +
                "FARStatus\n" +
                "财务信息\n" +
                "结算方式\n" +
                "FSettleTypeID\n" +
                "财务信息\n" +
                "工作流信用逾期超标额度\n" +
                "FCreChkOverAmount\n" +
                "财务信息\n" +
                "结算币别\n" +
                "FSettleCurrID\n" +
                "财务信息\n" +
                "会员名称\n" +
                "FBuyerNick\n" +
                "财务信息\n" +
                "工作流信用超标金额\n" +
                "FCreChkAmount\n" +
                "财务信息\n" +
                "工作流信用检查状态\n" +
                "FCreChkStatus\n" +
                "财务信息\n" +
                "总成本(本位币)(暂未使用)\n" +
                "FBillCostAmount_LC\n" +
                "财务信息\n" +
                "货主供应商\n" +
                "FOwnerSupplierID\n" +
                "财务信息\n" +
                "总成本(暂未使用)\n" +
                "FBillCostAmount\n" +
                "财务信息\n" +
                "管易订单标记名称\n" +
                "FGYTAGNAME\n" +
                "财务信息\n" +
                "会员编码\n" +
                "FVIPCODE\n" +
                "财务信息\n" +
                "价税合计（本位币）\n" +
                "FBillAllAmount_LC\n" +
                "财务信息\n" +
                "汇率类型\n" +
                "FExchangeTypeID\n" +
                "财务信息\n" +
                "价税合计\n" +
                "FBillAllAmount\n" +
                "财务信息\n" +
                "收货人国家\n" +
                "FReceiverCountry\n" +
                "财务信息\n" +
                "结算组织客户\n" +
                "FSETTLECustomerID\n" +
                "财务信息\n" +
                "收货人电话\n" +
                "FReceiverPhone\n" +
                "财务信息\n" +
                "结算组织\n" +
                "FSettleOrgID\n" +
                "财务信息\n" +
                "价外税\n" +
                "FIsPriceExcludeTax\n" +
                "财务信息\n" +
                "税额（本位币）\n" +
                "FBillTaxAmount_LC\n" +
                "财务信息\n" +
                "第三方单据编号\n" +
                "FThirdBillNo\n" +
                "财务信息\n" +
                "信用月结超标\n" +
                "FCreMonControlOver\n" +
                "财务信息\n" +
                "金额\n" +
                "FBillAmount\n" +
                "财务信息\n" +
                "折扣表\n" +
                "FDiscountListId\n" +
                "财务信息\n" +
                "整单折扣额\n" +
                "FAllDisCount\n" +
                "财务信息\n" +
                "收货人手机\n" +
                "FReceiverMobile\n" +
                "财务信息\n" +
                "金额（本位币）\n" +
                "FBillAmount_LC\n" +
                "财务信息\n" +
                "跨组织结算生成\n" +
                "FISGENFORIOS\n" +
                "财务信息\n" +
                "收款条件\n" +
                "FReceiptConditionID\n" +
                "财务信息\n" +
                "是否含税\n" +
                "FIsIncludedTax\n" +
                "财务信息\n" +
                "管易订单标记编码\n" +
                "FGYTAGCODE\n" +
                "财务信息\n" +
                "第三方系统来源\n" +
                "FThirdSrcType\n" +
                "财务信息\n" +
                "价目表\n" +
                "FPriceListId\n" +
                "财务信息\n" +
                "应收单业务日期\n" +
                "FReceivaDate\n" +
                "财务信息\n" +
                "信用压批超标\n" +
                "FCrePreBatchOver\n" +
                "财务信息\n" +
                "税额\n" +
                "FBillTaxAmount\n" +
                "财务信息\n" +
                "收货人省份\n" +
                "FReceiverState\n" +
                "财务信息\n" +
                "收货人\n" +
                "FReceiverName\n" +
                "财务信息\n" +
                "收货人地址\n" +
                "FReceiverAddress\n" +
                "财务信息\n" +
                "收货人地区\n" +
                "FReceiverDistrict\n" +
                "财务信息\n" +
                "汇率\n" +
                "FExchangeRate\n" +
                "财务信息\n" +
                "第三方单据平台单号\n" +
                "FThirdBillId\n" +
                "财务信息\n" +
                "工作流信用超标天数\n" +
                "FCreChkDays\n" +
                "财务信息\n" +
                "收货人城市\n" +
                "FReceiverCity\n" +
                "财务信息\n" +
                "本位币\n" +
                "FLocalCurrID\n" +
                "财务信息\n" +
                "审批流信用压批月结检查\n" +
                "FCrePreBatAndMonStatus\n" +
                "明细信息\n" +
                "携带的主业务单位\n" +
                "FSRCBIZUNITID\n" +
                "明细信息\n" +
                "最低限价\n" +
                "FLimitDownPrice\n" +
                "明细信息\n" +
                "仓位\n" +
                "FStockLocID\n" +
                "明细信息\n" +
                "基本单位\n" +
                "FBaseUnitID\n" +
                "明细信息\n" +
                "关联应收数量（销售基本）\n" +
                "FSalBaseARJoinQty\n" +
                "明细信息\n" +
                "冲销数量(销售基本)\n" +
                "FWRITEOFFSALEBASEQTY\n" +
                "明细信息\n" +
                "完全勾稽（作废）\n" +
                "FFullyJoined\n" +
                "明细信息\n" +
                "销售基本数量\n" +
                "FSALBASEQTY\n" +
                "明细信息\n" +
                "库存状态转换单ENTRYID\n" +
                "FConvertEntryID\n" +
                "明细信息\n" +
                "检验确认人\n" +
                "FValidateConfirmor\n" +
                "明细信息\n" +
                "批号拣货结果标识\n" +
                "FLotPickFlag\n" +
                "明细信息\n" +
                "预留锁库EntryId\n" +
                "FReserveEntryId\n" +
                "明细信息\n" +
                "累计退货通知数量\n" +
                "FSumRetNoticeQty\n" +
                "明细信息\n" +
                "发货检验\n" +
                "FCheckDelivery\n" +
                "明细信息\n" +
                "关联应收数量（库存基本）\n" +
                "FStockBaseARJoinQty\n" +
                "明细信息\n" +
                "未关联应收数量（计价单位）\n" +
                "FARNOTJOINQTY\n" +
                "明细信息\n" +
                "签收数量\n" +
                "FSignQty\n" +
                "明细信息\n" +
                "拆单数量（计价）\n" +
                "FDisPriceQty\n" +
                "明细信息\n" +
                "实发数量\n" +
                "FRealQty\n" +
                "明细信息\n" +
                "生产日期\n" +
                "FProduceDate\n" +
                "明细信息\n" +
                "行关联应收状态\n" +
                "FRowARStatus\n" +
                "明细信息\n" +
                "金额\n" +
                "FAmount\n" +
                "明细信息\n" +
                "拒收数量\n" +
                "FRefuseQty\n" +
                "明细信息\n" +
                "折扣额\n" +
                "FDiscount\n" +
                "明细信息\n" +
                "勾稽数量（作废）\n" +
                "FJoinedQty\n" +
                "明细信息\n" +
                "基本单位应发数量\n" +
                "FBaseMustQty\n" +
                "明细信息\n" +
                "补货数量\n" +
                "FRepairQty\n" +
                "明细信息\n" +
                "系统定价\n" +
                "FSysPrice\n" +
                "明细信息\n" +
                "冲销数量(库存基本)\n" +
                "FWRITEOFFSTOCKBASEQTY\n" +
                "明细信息\n" +
                "序列号单位\n" +
                "FSNUnitID\n" +
                "明细信息\n" +
                "组织间结算跨法人标识\n" +
                "FIsOverLegalOrg\n" +
                "明细信息\n" +
                "净价\n" +
                "FTaxNetPrice\n" +
                "明细信息\n" +
                "尾差处理标识\n" +
                "FTailDiffFlag\n" +
                "明细信息\n" +
                "库存单位\n" +
                "FUnitID\n" +
                "明细信息\n" +
                "计价基本数量\n" +
                "FPRICEBASEQTY\n" +
                "明细信息\n" +
                "未勾稽金额（作废）\n" +
                "FUnJoinAmount\n" +
                "明细信息\n" +
                "客户物料编码\n" +
                "FCustMatID\n" +
                "明细信息\n" +
                "产品类型\n" +
                "FRowType\n" +
                "明细信息\n" +
                "库存更新标识\n" +
                "FStockFlag\n" +
                "明细信息\n" +
                "有效期至\n" +
                "FExpiryDate\n" +
                "明细信息\n" +
                "累计应收数量（销售）\n" +
                "FSumInvoicedQty\n" +
                "明细信息\n" +
                "到货日期\n" +
                "FArrivalDate\n" +
                "明细信息\n" +
                "规格型号\n" +
                "FMateriaModel\n" +
                "明细信息\n" +
                "备注\n" +
                "FEntrynote\n" +
                "明细信息\n" +
                "货主类型\n" +
                "FOwnerTypeID\n" +
                "明细信息\n" +
                "是否补货\n" +
                "FIsRepair\n" +
                "明细信息\n" +
                "关联入库数量(基本单位)\n" +
                "FBaseJoinInStockQty\n" +
                "明细信息\n" +
                "税额\n" +
                "FEntryTaxAmount\n" +
                "明细信息\n" +
                "销售订单EntryId\n" +
                "FSOEntryId\n" +
                "明细信息\n" +
                "保管者类型\n" +
                "FKeeperTypeID\n" +
                "明细信息\n" +
                "是否替代出库\n" +
                "FIsReplaceOut\n" +
                "明细信息\n" +
                "行标识\n" +
                "FRowId\n" +
                "明细信息\n" +
                "父项产品\n" +
                "FParentMatId\n" +
                "明细信息\n" +
                "累计退货通知数量(销售基本)\n" +
                "FBaseSumRetNoticeQty\n" +
                "明细信息\n" +
                "业务流程\n" +
                "FBFLowId\n" +
                "明细信息\n" +
                "源单编号\n" +
                "FSrcBillNo\n" +
                "明细信息\n" +
                "关联入库数量\n" +
                "FJoinInStockQty\n" +
                "明细信息\n" +
                "销售单位\n" +
                "FSalUnitID\n" +
                "明细信息\n" +
                "入库单分录ID\n" +
                "FInStockEntryId\n" +
                "明细信息\n" +
                "计价单位\n" +
                "FPriceUnitId\n" +
                "明细信息\n" +
                "单价折扣\n" +
                "FPriceDiscount\n" +
                "明细信息\n" +
                "到货确认\n" +
                "FArrivalStatus\n" +
                "明细信息\n" +
                "累计退货数量\n" +
                "FSumRetStockQty\n" +
                "明细信息\n" +
                "库存请检单EntryID\n" +
                "FQmEntryID\n" +
                "明细信息\n" +
                "收料单编码_序号\n" +
                "FReceiveBillno\n" +
                "明细信息\n" +
                "未勾稽数量（作废）\n" +
                "FUNJOINQTY\n" +
                "明细信息\n" +
                "累计应收金额\n" +
                "FARAMOUNT\n" +
                "明细信息\n" +
                "实发数量(辅单位)\n" +
                "FExtAuxUnitQty\n" +
                "明细信息\n" +
                "累计开票数量(计价基本)(作废)\n" +
                "FBaseSumInvoicedQty\n" +
                "明细信息\n" +
                "物料名称\n" +
                "FMaterialName\n" +
                "明细信息\n" +
                "库存辅单位\n" +
                "FAuxUnitID\n" +
                "明细信息\n" +
                "库存辅单位数量\n" +
                "FAuxUnitQty\n" +
                "明细信息\n" +
                "总成本(本位币)\n" +
                "FCostAmount_LC\n" +
                "明细信息\n" +
                "客户物料名称\n" +
                "FCustMatName\n" +
                "明细信息\n" +
                "累计退货数量（库存基本）\n" +
                "FStockBaseSumRetStockQty\n" +
                "明细信息\n" +
                "收料单分录ID\n" +
                "FReceiveEntryId\n" +
                "明细信息\n" +
                "明细结算组织客户\n" +
                "FESettleCustomerId\n" +
                "明细信息\n" +
                "销售数量\n" +
                "FSALUNITQTY\n" +
                "明细信息\n" +
                "税组合\n" +
                "FTaxCombination\n" +
                "明细信息\n" +
                "第三方单据编号\n" +
                "FETHIRDBILLNO\n" +
                "明细信息\n" +
                "服务上下文\n" +
                "FServiceContext\n" +
                "明细信息\n" +
                "冲销数量(计价基本)\n" +
                "FWRITEOFFPRICEBASEQTY\n" +
                "明细信息\n" +
                "关联应收数量（计价基本）\n" +
                "FBaseARJoinQty\n" +
                "明细信息\n" +
                "BOM分录内码\n" +
                "FBOMEntryId\n" +
                "明细信息\n" +
                "库存状态\n" +
                "FStockStatusID\n" +
                "明细信息\n" +
                "BOM版本\n" +
                "FBomID\n" +
                "明细信息\n" +
                "关联退货数量(基本单位)\n" +
                "FBaseReturnQty\n" +
                "明细信息\n" +
                "检验确认\n" +
                "FValidateStatus\n" +
                "明细信息\n" +
                "价税合计\n" +
                "FAllAmount\n" +
                "明细信息\n" +
                "价格系数\n" +
                "FPriceCoefficient\n" +
                "明细信息\n" +
                "关联退货数量（辅单位）\n" +
                "FSECRETURNQTY\n" +
                "明细信息\n" +
                "关联应收数量\n" +
                "FARJoinQty\n" +
                "明细信息\n" +
                "拆单前原计价数量\n" +
                "FBeforeDisPriceQty\n" +
                "明细信息\n" +
                "当前库存\n" +
                "FInventoryQty\n" +
                "明细信息\n" +
                "总成本\n" +
                "FEntryCostAmount\n" +
                "明细信息\n" +
                "货主\n" +
                "FOwnerID\n" +
                "明细信息\n" +
                "保质期\n" +
                "FExpiryPeriod\n" +
                "明细信息\n" +
                "管易是否到账\n" +
                "FGYFINSTATUS\n" +
                "明细信息\n" +
                "关联应收金额\n" +
                "FARJOINAMOUNT\n" +
                "明细信息\n" +
                "零售条形码\n" +
                "FBarcode\n" +
                "明细信息\n" +
                "库存基本分母\n" +
                "FStockBaseDen\n" +
                "明细信息\n" +
                "含税单价\n" +
                "FTaxPrice\n" +
                "明细信息\n" +
                "控制出库数量\n" +
                "FOUTCONTROL\n" +
                "明细信息\n" +
                "实收数量\n" +
                "FActQty\n" +
                "明细信息\n" +
                "金额（本位币）\n" +
                "FAmount_LC\n" +
                "明细信息\n" +
                "保管者\n" +
                "FKeeperID\n" +
                "明细信息\n" +
                "折前价税合计\n" +
                "FBefDisAllAmt\n" +
                "明细信息\n" +
                "销售成本价\n" +
                "FSalCostPrice\n" +
                "明细信息\n" +
                "辅单位\n" +
                "FExtAuxUnitId\n" +
                "明细信息\n" +
                "是否零售促销\n" +
                "FRetailSaleProm\n" +
                "明细信息\n" +
                "管易发货时间\n" +
                "FGYENTERTIME\n" +
                "明细信息\n" +
                "消耗汇总\n" +
                "FIsConsumeSum\n" +
                "明细信息\n" +
                "关联入库数量（采购基本）\n" +
                "FPURBASEJOININSTOCKQTY\n" +
                "明细信息\n" +
                "计划跟踪号\n" +
                "FMtoNo\n" +
                "明细信息\n" +
                "入库单编码_序号\n" +
                "FInStockBillno\n" +
                "明细信息\n" +
                "项目编号\n" +
                "FProjectNo\n" +
                "明细信息\n" +
                "关联开票数量(基本单位)(作废)\n" +
                "FBaseInvoicedQty\n" +
                "明细信息\n" +
                "应发数量\n" +
                "FMustQty\n" +
                "明细信息\n" +
                "累计收款金额\n" +
                "FSumReceivedAMT\n" +
                "明细信息\n" +
                "折扣率%\n" +
                "FDiscountRate\n" +
                "明细信息\n" +
                "关联入库数量（辅单位）\n" +
                "FSECJOININSTOCKQTY\n" +
                "明细信息\n" +
                "第三方单据ID\n" +
                "FETHIRDBILLID\n" +
                "明细信息\n" +
                "供货金额\n" +
                "FProAmount\n" +
                "明细信息\n" +
                "源单类型\n" +
                "FSrcType\n" +
                "明细信息\n" +
                "物料（销售组织）\n" +
                "FMaterialID_Sal\n" +
                "明细信息\n" +
                "父行标识\n" +
                "FParentRowId\n" +
                "明细信息\n" +
                "销售基本分子\n" +
                "FSalBaseNum\n" +
                "明细信息\n" +
                "捡货部门\n" +
                "FPickDeptId\n" +
                "明细信息\n" +
                "管易订单单号\n" +
                "FThirdEntryId\n" +
                "明细信息\n" +
                "管易到账时间\n" +
                "FGYFINDate\n" +
                "明细信息\n" +
                "保质期单位\n" +
                "FExpiryPeriodUnit\n" +
                "明细信息\n" +
                "辅助属性\n" +
                "FAuxPropId\n" +
                "明细信息\n" +
                "明细货主供应商\n" +
                "FEOwnerSupplierId\n" +
                "明细信息\n" +
                "单价\n" +
                "FPrice\n" +
                "明细信息\n" +
                "勾稽金额（作废）\n" +
                "FJoinedAmount\n" +
                "明细信息\n" +
                "关联退货数量（库存基本）\n" +
                "FStockBaseReturnQty\n" +
                "明细信息\n" +
                "序列号单位数量\n" +
                "FSNQty\n" +
                "明细信息\n" +
                "行勾稽状态（作废）\n" +
                "FJoinStatus\n" +
                "明细信息\n" +
                "物料类别\n" +
                "FMateriaType\n" +
                "明细信息\n" +
                "是否生成产品档案\n" +
                "FIsCreateProDoc\n" +
                "明细信息\n" +
                "替代原物料编码\n" +
                "FReplaceMaterialID\n" +
                "明细信息\n" +
                "物料编码\n" +
                "FMaterialID\n" +
                "明细信息\n" +
                "行价目表\n" +
                "FPriceListEntry\n" +
                "明细信息\n" +
                "B2C订单明细Id\n" +
                "FB2CORDERDETAILID\n" +
                "明细信息\n" +
                "是否赠品\n" +
                "FIsFree\n" +
                "明细信息\n" +
                "累计开票金额(作废)\n" +
                "FSumInvoicedAMT\n" +
                "明细信息\n" +
                "成本价（本位币）\n" +
                "FCostPrice\n" +
                "明细信息\n" +
                "价税合计（本位币）\n" +
                "FAllAmount_LC\n" +
                "明细信息\n" +
                "库存基本数量\n" +
                "FBaseUnitQty\n" +
                "明细信息\n" +
                "质量类型\n" +
                "FQualifyType\n" +
                "明细信息\n" +
                "订单单号\n" +
                "FSoorDerno\n" +
                "明细信息\n" +
                "冲销金额\n" +
                "FWRITEOFFAMOUNT\n" +
                "明细信息\n" +
                "检验日期\n" +
                "FValidateDate\n" +
                "明细信息\n" +
                "税率%\n" +
                "FEntryTaxRate\n" +
                "明细信息\n" +
                "关联退货数量\n" +
                "FReturnQty\n" +
                "明细信息\n" +
                "批号\n" +
                "FLot\n" +
                "明细信息\n" +
                "按子项结算\n" +
                "FSettleBySon\n" +
                "明细信息\n" +
                "价税合计（折前）\n" +
                "FAllAmountExceptDisCount\n" +
                "明细信息\n" +
                "累计退货数量(基本单位)\n" +
                "FBaseSumRetstockQty\n" +
                "明细信息\n" +
                "门店供货价\n" +
                "FProPrice\n" +
                "明细信息\n" +
                "累计应收数量（销售基本）\n" +
                "FBASEARQTY\n" +
                "明细信息\n" +
                "折前金额\n" +
                "FBefDisAmt\n" +
                "明细信息\n" +
                "仓库\n" +
                "FStockID\n" +
                "明细信息\n" +
                "税额（本位币）\n" +
                "FTaxAmount_LC\n" +
                "明细信息\n" +
                "计价数量\n" +
                "FPriceUnitQty\n" +
                "明细信息\n" +
                "到货确认人\n" +
                "FArrivalConfirmor\n" +
                "明细信息\n" +
                "VMI业务\n" +
                "FVmiBusinessStatus\n" +
                "明细信息\n" +
                "累计开票数量(作废)\n" +
                "FInvoicedQty\n" +
                "税务明细\n" +
                "税额\n" +
                "FTaxAmount\n" +
                "税务明细\n" +
                "税率%\n" +
                "FTaxRate\n" +
                "税务明细\n" +
                "计入成本比例%\n" +
                "FCostPercent\n" +
                "税务明细\n" +
                "买方代扣代缴\n" +
                "FBuyerWithholding\n" +
                "税务明细\n" +
                "增值税\n" +
                "FVAT\n" +
                "税务明细\n" +
                "税率名称\n" +
                "FTaxRateId\n" +
                "税务明细\n" +
                "卖方代扣代缴\n" +
                "FSellerWithholding\n" +
                "税务明细\n" +
                "计入成本金额\n" +
                "FCostAmount\n" +
                "序列号子单据体\n" +
                "SN\n" +
                "FSN\n" +
                "序列号子单据体\n" +
                "IMEI2\n" +
                "FIMEI2\n" +
                "序列号子单据体\n" +
                "IMEI1\n" +
                "FIMEI1\n" +
                "序列号子单据体\n" +
                "下推退货通知标识\n" +
                "FPushReturnNotice\n" +
                "序列号子单据体\n" +
                "序列号\n" +
                "FSerialNo\n" +
                "序列号子单据体\n" +
                "备注\n" +
                "FSerialNote\n" +
                "序列号子单据体\n" +
                "序列号\n" +
                "FSerialId\n" +
                "序列号子单据体\n" +
                "MEID\n" +
                "FMEID\n" +
                "物流跟踪明细\n" +
                "物流单号\n" +
                "FCarryBillNo\n" +
                "物流跟踪明细\n" +
                "起始地点\n" +
                "FFrom\n" +
                "物流跟踪明细\n" +
                "发货时间\n" +
                "FDelTime\n" +
                "物流跟踪明细\n" +
                "类型\n" +
                "FCarryBillNoType\n" +
                "物流跟踪明细\n" +
                "物流公司\n" +
                "FLogComId\n" +
                "物流跟踪明细\n" +
                "终止地点\n" +
                "FTo\n" +
                "物流跟踪明细\n" +
                "签收时间\n" +
                "FReceiptTime\n" +
                "物流跟踪明细\n" +
                "物流状态\n" +
                "FTraceStatus\n" +
                "物流跟踪明细\n" +
                "寄件人手机号码\n" +
                "FPhoneNumber\n" +
                "物流详细信息\n" +
                "物流详情\n" +
                "FTraceDetail\n" +
                "物流详细信息\n" +
                "时间\n" +
                "FTraceTime\n" +
                "关联关系表\n" +
                "迁移图\n" +
                "FEntity_Link_FLnk1TrackerId\n" +
                "关联关系表\n" +
                "原始携带量\n" +
                "FEntity_Link_FPRICEBASEQTYOld\n" +
                "关联关系表\n" +
                "推进路线\n" +
                "FEntity_Link_FFlowLineId\n" +
                "关联关系表\n" +
                "上游状态\n" +
                "FEntity_Link_FLnkSState\n" +
                "关联关系表\n" +
                "修改携带量\n" +
                "FEntity_Link_FBaseUnitQty\n" +
                "关联关系表\n" +
                "源单表内码\n" +
                "FEntity_Link_FSTableId\n" +
                "关联关系表\n" +
                "源单表\n" +
                "FEntity_Link_FSTableName\n" +
                "关联关系表\n" +
                "原始携带量\n" +
                "FEntity_Link_FAuxUnitQtyOld\n" +
                "关联关系表\n" +
                "上游状态\n" +
                "FEntity_Link_FLnk1SState\n" +
                "关联关系表\n" +
                "修改携带量\n" +
                "FEntity_Link_FSALBASEQTY\n" +
                "关联关系表\n" +
                "转换规则\n" +
                "FEntity_Link_FRuleId\n" +
                "关联关系表\n" +
                "迁移图\n" +
                "FEntity_Link_FLnkTrackerId\n" +
                "关联关系表\n" +
                "数量FLnk1\n" +
                "FEntity_Link_FLnk1Amount\n" +
                "关联关系表\n" +
                "原始携带量\n" +
                "FEntity_Link_FSALBASEQTYOld\n" +
                "关联关系表\n" +
                "数量FLnk\n" +
                "FEntity_Link_FLnkAmount\n" +
                "关联关系表\n" +
                "源单内码\n" +
                "FEntity_Link_FSBillId\n" +
                "关联关系表\n" +
                "修改携带量\n" +
                "FEntity_Link_FAuxUnitQty\n" +
                "关联关系表\n" +
                "源单分录内码\n" +
                "FEntity_Link_FSId\n" +
                "关联关系表\n" +
                "修改携带量\n" +
                "FEntity_Link_FPRICEBASEQTY\n" +
                "关联关系表\n" +
                "业务流程图\n" +
                "FEntity_Link_FFlowId\n" +
                "关联关系表\n" +
                "原始携带量\n" +
                "FEntity_Link_FBaseUnitQtyOld";

        //按照换行符分割
        String[] split = str.split("\n");
        HashMap<String, String> enName_cnName = new HashMap<>();
        // 下标是 1,4,7.x,x,x 是中文名  2,5,8,x,x,x 是英文名
        for (int i = 0; i < split.length; i++) {
            if (i % 3 == 1) {
                enName_cnName.put(split[i + 1], split[i]);
            }
        }
//        System.out.println(JSONUtil.toJsonStr(enName_cnName));

        //并不是所有的 字段名都能查出来数据的，这里需要尝试一下
        Set<String> fieldSet = enName_cnName.keySet();
        StringBuilder fieldString = new StringBuilder();
        for (String s : fieldSet) {
            fieldString.append(s).append(",");
        }
        //去掉最后一个逗号
        fieldString.deleteCharAt(fieldString.length() - 1);


        IdentifyInfo iden = new IdentifyInfo();

//        iden.setUserName("周保坤");
//        iden.setAppId("282695_2Z8uSbksUpo9QbzL1ZTPzZWG1vWXxALK");
//        iden.setdCID("64a158f29b6199");
//        iden.setAppSecret("3533b17476684a64bb710ceec7927b23");
//        iden.setlCID(2052);
//        iden.setServerUrl("https://94me2ij82028.vicp.fun/k3cloud");

        iden.setUserName("沈俊杰");
        iden.setAppId("277491_Q/0JQYvHzlDeX+Ss24WqzawK1I6a0PPE");
        iden.setdCID("1373031008873496576");
        iden.setAppSecret("ec53784952b94411bccca7d586cd21aa");
        iden.setlCID(2052);
        iden.setServerUrl("https://api.kingdee.com/galaxyapi");

        K3CloudApi client = new K3CloudApi(iden);

        String jsonData = "{\n" +
                "    \"FormId\": \"" + formId + "\",\n" +
                "    \"FieldKeys\": \"" + fieldString + "\",\n" +
                "    \"TopRowCount\": 1,\n" +
                "    \"StartRow\": 0,\n" +
                "    \"Limit\": 2000,\n" +
                "    \"FilterString\": [\n" +
                "        {\n" +
                "            \"Left\": \"(\",\n" +
                "            \"FieldName\": \"FCreateDate\",\n" +
                "            \"Compare\": \">\",\n" +
                "            \"Value\": \"2000-07-01 00:00:00\",\n" +
                "            \"Right\": \")\",\n" +
                "            \"Logic\": \"0\"\n" +
                "        },\n" +
                "        {\n" +
                "            \"Left\": \"(\",\n" +
                "            \"FieldName\": \"FCreateDate\",\n" +
                "            \"Compare\": \"<\",\n" +
                "            \"Value\": \"2024-07-06 00:00:00\",\n" +
                "            \"Right\": \")\",\n" +
                "            \"Logic\": \"0\"\n" +
                "        }\n" +
                "    ]\n" +
                "}";

        while (true) {
            List<List<Object>> lists = client.executeBillQuery(jsonData);
            String string = lists.toString();
            if (string.contains("未购买")) {
                System.out.println("错误信息------->  " + string);
                return;
            }
            if (string.contains("元数据中标识为")) {
                //这里说明有字段没有查出来，定位到是哪个字段
                int start = string.indexOf("元数据中标识为");
                int end = string.indexOf("的字段不存在");
                String substring = string.substring(start + 7, end);
                //去掉这个字段
                System.out.println("去掉字段------->  " + substring);
                fieldSet.remove(substring);
                enName_cnName.remove(substring);
                //重新拼接
                StringBuilder fieldString2 = new StringBuilder();
                for (String s : fieldSet) {
                    fieldString2.append(s).append(",");
                }
                //去掉最后一个逗号
                fieldString2.deleteCharAt(fieldString2.length() - 1);
                jsonData = "{\n" +
                        "    \"FormId\": \"" + formId + "\",\n" +
                        "    \"FieldKeys\": \"" + fieldString2 + "\",\n" +
                        "    \"TopRowCount\": 1,\n" +
                        "    \"StartRow\": 0,\n" +
                        "    \"Limit\": 2000,\n" +
                        "    \"FilterString\": [\n" +
                        "        {\n" +
                        "            \"Left\": \"(\",\n" +
                        "            \"FieldName\": \"FCreateDate\",\n" +
                        "            \"Compare\": \">\",\n" +
                        "            \"Value\": \"2000-07-01 00:00:00\",\n" +
                        "            \"Right\": \")\",\n" +
                        "            \"Logic\": \"0\"\n" +
                        "        },\n" +
                        "        {\n" +
                        "            \"Left\": \"(\",\n" +
                        "            \"FieldName\": \"FCreateDate\",\n" +
                        "            \"Compare\": \"<\",\n" +
                        "            \"Value\": \"2024-07-06 00:00:00\",\n" +
                        "            \"Right\": \")\",\n" +
                        "            \"Logic\": \"0\"\n" +
                        "        }\n" +
                        "    ]\n" +
                        "}";

            } else if ("[]".equals(string)) {
                System.out.println("没有数据");
                return;
            } else {
                break;
            }
        }


        //此时 enName_cnName 里面的数据就是可以查出来的数据的字段 并且还有着中英文的对照关系
        //用可以查处数据的字段去查数据
        Set<String> canFindDataFieldSet = enName_cnName.keySet();
        StringBuilder canFindDataFieldString = new StringBuilder();
        for (String s : canFindDataFieldSet) {
            canFindDataFieldString.append(s).append(",");
        }
        //去掉最后一个逗号
        canFindDataFieldString.deleteCharAt(canFindDataFieldString.length() - 1);
        //查询数据
        String jsonData2 = "{\n" +
                "    \"FormId\": \"" + formId + "\",\n" +
                "    \"FieldKeys\": \"" + canFindDataFieldString + "\",\n" +
                "    \"TopRowCount\": 1,\n" +
                "    \"StartRow\": 0,\n" +
                "    \"Limit\": 2000,\n" +
                "    \"FilterString\": [\n" +
                "        {\n" +
                "            \"Left\": \"(\",\n" +
                "            \"FieldName\": \"FCreateDate\",\n" +
                "            \"Compare\": \">\",\n" +
                "            \"Value\": \"2000-07-01 00:00:00\",\n" +
                "            \"Right\": \")\",\n" +
                "            \"Logic\": \"0\"\n" +
                "        },\n" +
                "        {\n" +
                "            \"Left\": \"(\",\n" +
                "            \"FieldName\": \"FCreateDate\",\n" +
                "            \"Compare\": \"<\",\n" +
                "            \"Value\": \"2024-07-06 00:00:00\",\n" +
                "            \"Right\": \")\",\n" +
                "            \"Logic\": \"0\"\n" +
                "        }\n" +
                "    ]\n" +
                "}";
        List<List<Object>> lists = client.executeBillQuery(jsonData2);
        List<Object> objects = lists.get(0);//第一条数据
        String[] fields = canFindDataFieldString.toString().split(",");//字段
        //将数据和字段对应起来
        ArrayList<FieldData> fieldDataArrayList = new ArrayList<>();
        for (int i = 0; i < fields.length; i++) {
            String enName = fields[i];//获取第一个字段的英文名
            Object dataValue = objects.get(i);//获取第一个字段的数据
            if (dataValue == null || StrUtil.isBlank(dataValue.toString())) {
                dataValue = "null";
            }
            String cnName = enName_cnName.get(enName);//获取第一个字段的中文名
            fieldDataArrayList.add(new FieldData(enName, dataValue, cnName));
        }

        System.out.println("===================最终版本====================");
        System.out.println("一共有---> " + fieldDataArrayList.size() + " <-----个字段");
        System.out.println();
        System.out.println();
        System.out.println();

        StringBuilder createTableSql = new StringBuilder();
        createTableSql.append("create table ").append(formId.toLowerCase()).append("_jd").append("(\n");
        createTableSql.append("bai_shu_id int primary key auto_increment comment '百数云系统id',\n");
        createTableSql.append("bai_shu_create_time datetime default NOW() null comment '百数云创建时间',\n");

        for (FieldData fieldData : fieldDataArrayList) {
            createTableSql.append("#").append(fieldData.toString()).append("\n");

//            判断类型并完成建表语句
//            将 #FModifierId : 100087 : 修改人  这种格式的数据转换成  FModifierId int null comment '修改人',
            determineTypeAndCompleteListClause(fieldData, createTableSql);
        }
        //去掉最后一个逗号
        createTableSql.deleteCharAt(createTableSql.length() - 2);

        createTableSql.append(") comment '").append(formId).append("-").append(formIdCnName).append("';");

        System.out.println(createTableSql);


    }

    //将 #FModifierId : 100087 : 修改人  这种格式的数据转换成  FModifierId int null comment '修改人',
    private static void determineTypeAndCompleteListClause(FieldData fieldData, StringBuilder createTableSql) {
        createTableSql.append(fieldData.getEnName()).append(" ");

        //判断类型
        String dataValue = fieldData.getDataValue().toString();
        String cnName = fieldData.getCnName();
        if (cnName.contains("编码") || cnName.contains("编号")) {
            createTableSql.append("varchar(255) null ");
        } else if (StrUtil.isBlank(dataValue)) {
            createTableSql.append("varchar(255) null ");
        } else if ("null".equals(dataValue.trim())) {
            createTableSql.append("varchar(255) null ");
        } else if ("false".equals(dataValue.trim()) || "true".equals(dataValue.trim())) {
            createTableSql.append("varchar(255) null ");
        } else if (dataValue.matches("[0-9]+")) {
            createTableSql.append("int null ");
        } else if (dataValue.matches("[0-9]+.[0-9]+")) {
            createTableSql.append("double null ");
        } else if (dataValue.matches("[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]+")) {//#FCreateDate : 2022-03-22T11:47:44.167 : 创建日期
            createTableSql.append("datetime null ");
        } else {
            //汉字  或者是 字符串
            createTableSql.append("varchar(255) null ");
        }

        createTableSql.append("comment '").append(fieldData.getCnName()).append("',\n");
    }
}


class FieldData {
    private String enName;
    private Object dataValue;
    private String cnName;

    public FieldData(String enName, Object dataValue, String cnName) {
        this.enName = enName;
        this.dataValue = dataValue;
        this.cnName = cnName;
    }

    @Override
    public String toString() {
        return enName + " : " + dataValue + " : " + cnName;
    }

    public String getEnName() {
        return enName;
    }

    public Object getDataValue() {
        return dataValue;
    }

    public String getCnName() {
        return cnName;
    }
}